package cn.dujc.superkid.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * @author du
 * date 2018/7/28 下午10:11
 */
public class ConsumptionResult implements Parcelable {
    /**
     * order : [{"price":"600.00","buytime":1488192362,"productid":4,"vip_start_time":1488192362,"vip_ent_time":1490611562,"product_name":"月会员"}]
     * price : 960
     */

    private String price;//消费累计金额
    private List<OrderEntity> order;

    public String getPrice() { return price;}

    public void setPrice(String price) { this.price = price;}

    public List<OrderEntity> getOrder() { return order;}

    public void setOrder(List<OrderEntity> order) { this.order = order;}

    @Override
    public int describeContents() { return 0; }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.price);
        dest.writeTypedList(this.order);
    }

    public ConsumptionResult() {}

    protected ConsumptionResult(Parcel in) {
        this.price = in.readString();
        this.order = in.createTypedArrayList(OrderEntity.CREATOR);
    }

    public static final Creator<ConsumptionResult> CREATOR = new Creator<ConsumptionResult>() {
        @Override
        public ConsumptionResult createFromParcel(Parcel source) {return new ConsumptionResult(source);}

        @Override
        public ConsumptionResult[] newArray(int size) {return new ConsumptionResult[size];}
    };

    public static class OrderEntity implements Parcelable {
        /**
         * price : 600.00
         * buytime : 1488192362
         * productid : 4
         * vip_start_time : 1488192362
         * vip_ent_time : 1490611562
         * product_name : 月会员
         */

        private String price;//消费金额
        private String buytime;//购买时间
        private String productid;//产品id
        private String vip_start_time;//vip开始时间
        private String vip_ent_time;//vip结束时间
        private String product_name;//消费产品名

        public String getPrice() { return price;}

        public void setPrice(String price) { this.price = price;}

        public String getBuytime() { return buytime;}

        public void setBuytime(String buytime) { this.buytime = buytime;}

        public String getProductid() { return productid;}

        public void setProductid(String productid) { this.productid = productid;}

        public String getVip_start_time() { return vip_start_time;}

        public void setVip_start_time(String vip_start_time) { this.vip_start_time = vip_start_time;}

        public String getVip_ent_time() { return vip_ent_time;}

        public void setVip_ent_time(String vip_ent_time) { this.vip_ent_time = vip_ent_time;}

        public String getProduct_name() { return product_name;}

        public void setProduct_name(String product_name) { this.product_name = product_name;}

        @Override
        public int describeContents() { return 0; }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.price);
            dest.writeString(this.buytime);
            dest.writeString(this.productid);
            dest.writeString(this.vip_start_time);
            dest.writeString(this.vip_ent_time);
            dest.writeString(this.product_name);
        }

        public OrderEntity() {}

        protected OrderEntity(Parcel in) {
            this.price = in.readString();
            this.buytime = in.readString();
            this.productid = in.readString();
            this.vip_start_time = in.readString();
            this.vip_ent_time = in.readString();
            this.product_name = in.readString();
        }

        public static final Creator<OrderEntity> CREATOR = new Creator<OrderEntity>() {
            @Override
            public OrderEntity createFromParcel(Parcel source) {return new OrderEntity(source);}

            @Override
            public OrderEntity[] newArray(int size) {return new OrderEntity[size];}
        };
    }

}
